TeamsDR-Add Customer Device

The TeamsDR-Add Customer Device script adds a device to an existing Teams Direct Routing Customer, and is shown below:

Copy
### Script Version 1.2 ###
# Adding Device to existing Customer
# Id: 5461224
# 
# Customer variables:
#     Device_IPAddress
#     Device_SIPPort
#     Device_TransportType_UDP-TCP-TLS
#     Device_MediaSecurity_Secure-Unsecure

configure network
access-list new
    source-ip "{{CustomVar.Device_IPAddress}}"
    prefixLen 32
    description "{{CustomerId}}"
    use-specific-interface enable
    network-interface-name "eth1"
    activate
   exit
   exit
   
configure voip
proxy-set new
  proxy-name "{{CustomerId}}"
  proxy-enable-keep-alive using-options
  srd-name "DefaultSRD"
  sbcipv4-sip-int-name "Cust-Public"
  activate
  proxy-ip 0
    proxy-address "{{CustomVar.Device_IPAddress}}:{{CustomVar.Device_SIPPort}}"
    transport-type "{{CustomVar.Device_TransportType_UDP-TCP-TLS}}"
    activate
    exit
  exit

ip-group upsert name "{{CustomerId}}-c"
  name "{{CustomerId}}-c"
  proxy-set-name "{{CustomerId}}"
  srd-name "DefaultSRD"
  ip-profile-name "{{CustomVar.Device_MediaSecurity_Secure-Unsecure}}"
  tags "Device={{SBC.OnlinePstnGateway}}&{{CustomerId}};MeteringTag={MeteringTag}"
  classify-by-proxy-set disable
  call-setup-rules-set-id 4 
 {{#if  SBC.EnableCAC}}    
   cac-profile "{{SBC.CacProfile}}"
 {{/if }}  
  activate 
 exit

 {{#if  SBC.FlagCarrierRegistration}}  
  sip-definition account new
   account-name "{{CustomerId}}"
   served-ip-group-name "{{SBC.CarrierID}}"
   serving-ip-group-name "{{CustomerId}}-c"
   user-name "{{SBC.CarrierUserName}}"
   password "{{SBC.CarrierPassword}}" 
   host-name "{{SBC.CarrierHostName}}"
   contact-user "{{SBC.CarrierMainLine}}"
   register reg
   application-type sbc
   activate
  exit
 {{/if }} 

 {{#each SBC.DialPlanPrefixes}}
  sbc dial-plan where name "CustDevice" 
  {{#each this.Rules}}
   dial-plan-rule new
     name "{{this.Name}}"
     prefix "{{this.Prefix}}"
     tag "FQDN={{this.Tag}};Device={{this.Name}}"
   exit
  {{/each}}
  activate 
  exit
 {{/each}} 
do write